<?php
/** @var TbActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'blog-form',
    'type' => 'horizontal'
        ));
?>


<?php echo $form->errorSummary($model) ?>

<h3 class="heading">Main content</h3>

<?php echo $form->textFieldRow($model, 'node_title', array('class' => 'input-xxlarge')) ?>

<div class="control-group">

    <label class="control-label">Content</label>

    <div class="controls">

        <?php
        $this->widget('ext.tinymce.TinyMce', array(
            'model' => $model,
            'attribute' => 'node_content',
            // Optional config
            //'compressorRoute' => 'event/compressor',
            //'spellcheckerUrl' => array('tinyMce/spellchecker'),
            // or use yandex spell: http://api.yandex.ru/speller/doc/dg/tasks/how-to-spellcheck-tinymce.xml
            //'spellcheckerUrl' => 'http://speller.yandex.net/services/tinyspell',
            'fileManager' => array(
                'class' => 'ext.elFinder.TinyMceElFinder',
                'connectorRoute' => 'filemanager/connector',
            ),
            'htmlOptions' => array(
                'rows' => 6,
                'cols' => 60,
            )
        ));
        ?>

    </div>

</div>

<h3 class="heading">Other content</h3>

<ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#seo-tab">SEO</a></li>
    <li>
        <a data-toggle="tab" href="#image-tab">Image</a>
    </li>
    <li>
        <a data-toggle="tab" href="#publish-tab" >Publish</a>
    </li>

</ul>
<div class="tab-content">
    <div id="seo-tab" class="tab-pane active">
        <p class="help-block">Maximum 160 characters</p>

        <?php echo $form->textFieldRow($model, 'meta_title', array('class' => 'input-xxlarge')) ?>
        <?php echo $form->textFieldRow($model, 'meta_keywords', array('class' => 'input-xxlarge')) ?>
        <?php echo $form->textAreaRow($model, 'meta_description', array('class' => 'input-xxlarge')) ?>

    </div>

    <div id="image-tab" class="tab-pane fade">
        <div class="control-group">
            <label class="control-label">Featured Image</label>
            <div class="controls">
                <?php
                //set image
                $this->widget('ext.elFinder.ServerFileInput', array(
                    'name' => 'featuredImage',
                    'value' => isset($model->featuredImage->meta_value) ? $model->featuredImage->meta_value : '',
                    'connectorRoute' => '/filemanager/connector',
                        )
                );
                ?>
                <p class="help-block">Click browse then select file or paste link from external</p>

                <?php if ($model->featuredImage != NULL && $model->featuredImage != '') : ?>
                    <img src="<?php echo StringHelper::isValidUrl($model->featuredImage->meta_value) == true ? $model->featuredImage->meta_value : ImageHelper::thumb(100, 100, $model->featuredImage->meta_value) ?>" alt="featuredImage" />
                <?php endif; ?>

            </div>
        </div>
    </div>

        <div id="publish-tab" class="tab-pane fade">

            <?php echo $form->textFieldRow($model, 'node_alias', array('class' => 'input-xxlarge')) ?>
            <?php echo $form->dropDownListRow($model, 'node_status', Node::getSatusFilter()); ?>
        </div>
</div>



<div class="form-actions">

    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Submit')); ?>

    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'reset', 'label' => 'Reset')); ?>

</div>



<?php $this->endWidget(); ?>